
file(GLOB_RECURSE ALL_SOURCE_FILES *.cc *.h)

FUNCTION (EXCLUDE_FILES_FROM_DIR_IN_LIST _InFileList _excludeDirName)
  foreach (ITR ${_InFileList})
    if ("${ITR}" MATCHES "(.*)${_excludeDirName}(.*)")
      list (REMOVE_ITEM _InFileList ${ITR})
    endif ("${ITR}" MATCHES "(.*)${_excludeDirName}(.*)")
  endforeach(ITR)
  set(ALL_SOURCE_FILES ${_InFileList} PARENT_SCOPE)
ENDFUNCTION (EXCLUDE_FILES_FROM_DIR_IN_LIST)

add_custom_target(
        clangformat_check
        COMMAND /usr/bin/clang-format
        -Werror
        -n
        ${ALL_SOURCE_FILES}
)


add_custom_target(
        clangformat
        COMMAND /usr/bin/clang-format
        -i
        ${ALL_SOURCE_FILES}
)
